<?php
require_once('../phplib/include.inc.php');
require_once('../phplib/util/CheckLogin.inc.php');

class Admin_Savearticle{
	public function DoSave(){
		$picPath = Util::SavePic('picture');		
		$R = $_REQUEST;
		$c_id = intval($R['category']);
		$a_title = trim($R['title']);
		$a_content = $R['content'];
		$a_abstract = $R['abstract'];
		$sql = "INSERT INTO article (c_id,a_title,a_content,a_time,a_pic,a_abstract) VALUES ({0},{1},{2},NOW(),{3},{4})";
		$db = getDb();
		if(!$db->Execute($sql,array($c_id,$a_title,$a_content,$picPath,$a_abstract))) PageBase::Error("unknow error");
		PageBase::Go("../admin/index.php");
	}
}
$a = new Admin_Savearticle();
$a->DoSave();
?>